﻿using DL.AnimatorEvents;
using DL.Characters.Data;
using DL.Movement;
using UnityEngine;

namespace DL.Characters
{
    public class Actor : MonoBehaviour
    {
        //组件
        public  AnimatorEvent AnimationEvent { get; protected set; }
        public Animator Animator { get; protected set; }
        public CustomMovementController CustomMovementController { get; protected set; }
        
        public Transform Self { get; protected set; }

        [field:SerializeField,Header("数据表")]
        public CharacterSO CharacterSO { get; protected set; }

        private void Awake()
        {
            OnComponentLoad();
        }

        private void Start()
        {
            OnComponentInit();
        }

        private void OnEnable()
        {
            AddInputActionCallBacks();
        }

        private void OnDisable()
        {
            RemoveInputActionCallBacks();
        }

        /// <summary>
        /// 在Awake中调用，用于组件获取
        /// </summary>
        protected virtual void OnComponentLoad()
        {
        }
        
        /// <summary>
        /// 用于组件初始化，在Start调用
        /// </summary>
        protected virtual void OnComponentInit()
        {
        }
        
        /// <summary>
        /// 行为回调注册，在OnEnable调用
        /// </summary>
        protected virtual void AddInputActionCallBacks()
        {
        }


        /// <summary>
        /// 移除行为回调注册，在OnDisable调用
        /// </summary>
        protected virtual void RemoveInputActionCallBacks()
        {
        }
        
    }
}